/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ChessApps.Network;

import com.ChessApps.Interface.Interface;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author eikichie
 */
public class ThreadGame extends Thread{
   Interface ref;
        int i=0;
	public ThreadGame(Interface r)
	 {
		ref = r;
	 }
           
	public void run()
	 { 
		while(true)
		 {   while ("".equals(ref.getTableDeJeu().getMove()))
                      {
                       
                         try {
                             Thread.sleep(100);
                         } catch (InterruptedException ex) {
                             Logger.getLogger(ThreadGame.class.getName()).log(Level.SEVERE, null, ex);
                         }
                         }
                  ref.send("__move_"+ref.getTableDeJeu().getMove());
                  ref.writeMoves("Moi : "+ref.getTableDeJeu().getMove()+"\n");
                  ref.getTableDeJeu().setMove("");
                  
		 }
	 } 
}
